<style type="text/css">
    .butt {
        background: #336EAA !important;
    }
</style>
<!--内容区-->
<div class="cont">
    <div class="position "><img alt="位置图标" src="dist/images/position.png" />客户资源&gt;标签管理<a ng-click="openDetail('',index_key)" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i></a></div>
    <div class="mybackground">
        <div class="cont_fr_top">
            <div class="menus_top" style="border-bottom: none;">
                <div class="cont_fr_btn">
                    <div class="fr">
                        <!--<button class="cont_f_btn1" ng-model="file" ngf-select><i class="download icon"></i>导入</button>-->
                        <!--<button class="cont_f_btn3" ng-click="add_popup()"><i class="add icon"></i>添加</button>-->
                    </div>
                </div>
            </div>
            <div class="menus">
                <div class="menus_con">
                    <div class="ui form">
                        <div class="four fields">
                            <div class="inline field">
                                <label>标签名称</label>
                                <input type="text" id="t_name" placeholder="标签名称" ng-keyup="$event.keyCode == 13 && tagsDataList()">
                            </div>
                            <div class="inline field">
                                <label>创建时间</label>
                                <div class="ui left icon input">
                                    <input type="text" id="t_time" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" placeholder="时间" ng-keyup="$event.keyCode == 13 && tagsDataList()" /> <i class="calendar icon"></i>
                                </div>
                            </div>
                        </div>
                        <div class="fields" style="margin-left: 4.3em;">
                            <div class="four wide field">
                                <button class="search_btn" ng-click="tagsDataList()">查询</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="menus_table">
        <table class="ui yellow celled striped table">
            <thead>
                <tr>
                    <th style="width:25%">标签名</th>
                    <th style="width:27%">客户人数</th>
                    <th style="width:30%">创建时间</th>
                    <th style="width:18%; text-align: center;">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="vtag in tags">
                    <td>{{vtag.tag_name}}</td>
                    <td>{{vtag.person}}</td>
                    <td>{{vtag.create_time}}</td>
                    <td style="text-align: center;">
                        <a ng-click="showEdittag()">编辑</a>
                        <a ng-click="delTag()">删除</a>
                        <a ng-click="tagCustomer()">管理客户</a>
                    </td>
                </tr>
                <tr ng-show="tagsPages.pageAll == 0 && !busy">
                    <td colspan="4" style="color:red;">
                        <p style="text-align:center;">还没有找到数据~~~</p>
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="ui pagination menu fr" ng-show="tagsPages.pageAll > 1" class="ui borderless pagination menu" jspagination page-object="tagsPages" page-func="tagsDataList">
        </div>
    </div>
</div>

<!-- 添加标签信息弹出层 is begining here-->
<div class="ui add_tags modal">
    <i class="close icon"></i>
    <div class="header_h4">添加标签</div>
    <div class="content">
        <div class="form">
            <form action="#" name="frm-add" id="frm-add">
                <div class="ui form">
                    <div class="fields">
                        <div class="eleven wide field required">
                            <label class="label_fl">标签名称</label>
                            <input type="text" name="name" placeholder="请填写标签名称" style="width: 450px;">
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="actions" style="text-align: center;">
            <button class="ui green button positive">确认</button>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>
</div>
<!-- 添加标签信息弹出层 is ending here-->

<!-- 修改信息弹出层 is begining here-->
<div class="ui edit_tags modal">
    <i class="close icon"></i>
    <div class="header_h4">修改标签</div>
    <div class="content">
        <div class="form">
            <form action="#" name="frm-edit" id="frm-edit">
                <input type="hidden" name="tag_id">
                <div class="ui form">
                    <div class="fields">
                        <div class="eleven wide field required">
                            <label class="label_fl">标签名称</label>
                            <input type="text" name="name" placeholder="请填写标签名称" style="width: 450px;">
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="actions" style="text-align: center;">
            <button class="ui green button positive">确认</button>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>
</div>
<!-- 修改标签信息弹出层 is ending here-->

<!-- 客户信息弹出层 is begining here-->
<div class="ui customer modal">
    <i class="close icon"></i>
    <div class="header_h4">客户信息</div>
    <div class="content">
        <table class="ui yellow celled striped table" style="min-width: 150px;">
            <thead>
                <tr>
                    <th style="width:20%">客户名</th>
                    <th style="width:20%">昵称</th>
                    <th style="width:20%">联系方式</th>
                    <th style="width:26%">创建时间</th>
                    <th style="width:14%; text-align: center;">操作</th>
                </tr>
            </thead>
            <tbody id="full_customer">
                <tr ng-repeat="vcustomer in tagcustomer">
                    <td>{{vcustomer.login_name}}</td>
                    <td>{{vcustomer.nickname}}</td>
                    <td>{{vcustomer.phone}}</td>
                    <td>{{vcustomer.create_time}}</td>
                    <td style="text-align: center;">
                        <a ng-click="delCustomer()">删除</a>
                    </td>
                </tr>
            </tbody>
            <tbody ng-show="customerPages.pageAll == 0" style="color: red;text-align: center;border-top: none;font-size: 16px;">
                <tr>
                    <td colspan="5">
                        <p style="text-align: center;">没有找到数据~~~!</p>
                    </td>
                </tr>
            </tbody>
        </table>
        <div ng-show="customerPages.pageAll> 1" class="ui pagination menu" jspagination page-object="customerPages" page-func="tagCustomer">
        </div>
        <div class="actions" style="text-align: center;">
            <button class="ui green button positive">确认</button>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>
</div>
<!-- 客户信息弹出层 is ending here-->

<!--添加成功-->
<div class="ui modal modal1" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">{{tagMsg}}</p>
    </div>
</div>

<!--添加失败-->
<div class="ui modal modal2" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge red remove circle outline icon"></i>
        <p style="padding-top: 15px;">{{tagMsg}}</p>
    </div>
</div>

<!--确认删除-->
<div class="ui modal modal3">
    <div class="header" style="text-align: center;">删除标签管理</div>
    <div class="content" style="text-align: center;">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;">{{tagMsg}}</p>
    </div>
    <div class="actions" style="text-align: center;">
        <button class="ui green button positive">确认</button>
        <button class="ui grey button negative">取消</button>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        $('.ui.dropdown').dropdown();
        $('#frm-add').form({
            on: 'blur',
            inline: true,
            fields: {
                name: {
                    identifier: 'name',
                    rules: [{
                        type: 'empty',
                        prompt: '标签名称不能为空'
                    }]
                },
            }
        });

        $('#frm-edit').form({
            on: 'blur',
            inline: true,
            fields: {
                name: {
                    identifier: 'name',
                    rules: [{
                        type: 'empty',
                        prompt: '标签名称不能为空'
                    }]
                },
            }
        });
    });
</script>